
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/router-view/Home'
import Category from '@/views/router-view/Category'
Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: Home,
        name: 'home'
    },
    {
        path: '/category',
        component: Category,
        name: 'category'
    }
]

const router = new VueRouter({
    routes: routes,
    mode: 'history'
})

export default router


router.beforeEach(() => {
    // 
    // 根据 role 调用接口 获取角色对应的菜单路由
    router.addRoute(菜单路由)
})
